#!/bin/bash

echo "[STATUS] - Processing occupation files"
echo ""

#Rscript spatial_allocation/processOccupation.R scenarioANaive 1000
#Rscript spatial_allocation/processOccupation.R scenarioBNaive 1000
#Rscript spatial_allocation/processOccupation.R scenarioCNaive 1000

#Rscript spatial_allocation/processOccupation.R scenarioAImproved 1000
#Rscript spatial_allocation/processOccupation.R scenarioBImproved 1000
#Rscript spatial_allocation/processOccupation.R scenarioCImproved 1000

#Rscript spatial_allocation/processOccupation.R scenarioAInformed 1000
#Rscript spatial_allocation/processOccupation.R scenarioBInformed 1000
#Rscript spatial_allocation/processOccupation.R scenarioCInformed 1000

echo "[STATUS] - Process viewing times files"
echo ""

#Rscript spatial_allocation/processViewingTimes.R scenarioANaive
#Rscript spatial_allocation/processViewingTimes.R scenarioBNaive
#Rscript spatial_allocation/processViewingTimes.R scenarioCNaive

#Rscript spatial_allocation/processViewingTimes.R scenarioAImproved
#Rscript spatial_allocation/processViewingTimes.R scenarioBImproved
#Rscript spatial_allocation/processViewingTimes.R scenarioCImproved

#Rscript spatial_allocation/processViewingTimes.R scenarioAInformed
#Rscript spatial_allocation/processViewingTimes.R scenarioBInformed
#Rscript spatial_allocation/processViewingTimes.R scenarioCInformed

echo "[STATUS] - Produce Ecdf"
echo ""

cd ..

cp results/scenarioANaive/1.scenarioANaive.o25 results/Ecdf/A/1.Naive.o25
cp results/scenarioANaive/1.scenarioANaive.o50 results/Ecdf/A/1.Naive.o50
cp results/scenarioAImproved/1.scenarioAImproved.o25 results/Ecdf/A/2.Probabilistic.o25
cp results/scenarioAImproved/1.scenarioAImproved.o50 results/Ecdf/A/2.Probabilistic.o50
cp results/scenarioAInformed/1.scenarioAInformed.o25 results/Ecdf/A/3.Informed.o25
cp results/scenarioAInformed/1.scenarioAInformed.o50 results/Ecdf/A/3.Informed.o50

Rscript scripts/spatial_allocation/produceEcdf.R A 25
Rscript scripts/spatial_allocation/produceEcdf.R A 50

cp results/scenarioBNaive/1.scenarioBNaive.o25 results/Ecdf/B/1.Naive.o25
cp results/scenarioBNaive/1.scenarioBNaive.o50 results/Ecdf/B/1.Naive.o50
cp results/scenarioBImproved/1.scenarioBImproved.o25 results/Ecdf/B/2.Probabilistic.o25
cp results/scenarioBImproved/1.scenarioBImproved.o50 results/Ecdf/B/2.Probabilistic.o50
cp results/scenarioBInformed/1.scenarioBInformed.o25 results/Ecdf/B/3.Informed.o25
cp results/scenarioBInformed/1.scenarioBInformed.o50 results/Ecdf/B/3.Informed.o50

Rscript scripts/spatial_allocation/produceEcdf.R B 25
Rscript scripts/spatial_allocation/produceEcdf.R B 50


cp results/scenarioCNaive/1.scenarioCNaive.o25 results/Ecdf/C/1.Naive.o25
cp results/scenarioCNaive/1.scenarioCNaive.o50 results/Ecdf/C/1.Naive.o50
cp results/scenarioCImproved/1.scenarioCImproved.o25 results/Ecdf/C/2.Probabilistic.o25
cp results/scenarioCImproved/1.scenarioCImproved.o50 results/Ecdf/C/2.Probabilistic.o50
cp results/scenarioCInformed/1.scenarioCInformed.o25 results/Ecdf/C/3.Informed.o25
cp results/scenarioCInformed/1.scenarioCInformed.o50 results/Ecdf/C/3.Informed.o50

Rscript scripts/spatial_allocation/produceEcdf.R C 25
Rscript scripts/spatial_allocation/produceEcdf.R C 50

echo "[STATUS] - Produce Comparison Plots"
echo ""

cp results/scenarioANaive/MaxErrorPlots.cmp results/Comparison/A/1.Naive.cmp
cp results/scenarioAImproved/MaxErrorPlots.cmp results/Comparison/A/2.Probabilistic.cmp
cp results/scenarioAInformed/MaxErrorPlots.cmp results/Ecdf/Comparison/3.Informed.cmp

Rscript scripts/spatial_allocation/ComparisonPlot.R A 3
Rscript scripts/spatial_allocation/ComparisonPlot.R A 6

cp results/scenarioBNaive/MaxErrorPlots.cmp results/Comparison/B/1.Naive.cmp
cp results/scenarioBImproved/MaxErrorPlots.cmp results/Comparison/B/2.Probabilistic.cmp
cp results/scenarioBInformed/MaxErrorPlots.cmp results/Comparison/B/3.Informed.cmp

Rscript scripts/spatial_allocation/ComparisonPlot.R B 3
Rscript scripts/spatial_allocation/ComparisonPlot.R B 6

cp results/scenarioCNaive/MaxErrorPlots.cmp results/Comparison/C/1.Naive.cmp
cp results/scenarioCImproved/MaxErrorPlots.cmp results/Comparison/C/2.Probabilistic.cmp
cp results/scenarioCInformed/MaxErrorPlots.cmp results/Comparison/C/3.Informed.cmp

Rscript scripts/spatial_allocation/ComparisonPlot.R C 3
Rscript scripts/spatial_allocation/ComparisonPlot.R C 6

echo "[STATUS] - Perform statistical tests"
echo ""

cp results/scenarioANaive/scenarioANaive.samples results/Tests/A/scenarioANaive.samples
cp results/scenarioBNaive/scenarioBNaive.samples results/Tests/B/scenarioBNaive.samples
cp results/scenarioCNaive/scenarioCNaive.samples results/Tests/C/scenarioCNaive.samples

cp results/scenarioAImproved/scenarioAImproved.samples results/Tests/A/scenarioAImproved.samples
cp results/scenarioBImproved/scenarioBImproved.samples results/Tests/B/scenarioBImproved.samples
cp results/scenarioCImproved/scenarioCImproved.samples results/Tests/C/scenarioCImproved.samples

cp results/scenarioAInformed/scenarioAInformed.samples results/Tests/A/scenarioAInformed.samples
cp results/scenarioBInformed/scenarioBInformed.samples results/Tests/B/scenarioBInformed.samples
cp results/scenarioCInformed/scenarioCInformed.samples results/Tests/C/scenarioCInformed.samples

Rscript scripts/spatial_allocation/performStatisticalTests.R A
Rscript scripts/spatial_allocation/performStatisticalTests.R B
Rscript scripts/spatial_allocation/performStatisticalTests.R C

